{extends file="main.tpl"}
{block name=head}
<script type="text/javascript">
$(document).ready(function() {
  $("#party").autocomplete("getPartyNameAuto.php", 
	{    
		width: 150,     
		matchContains: true,
		mustMatch: false,
		minChars: 0,
		//multiple: true,
		highlight: false,
		//multipleSeparator: ",",
		selectFirst: true,
		formatItem: function(data, i, n, value) {   
		  return  value.split("|")[0];
	  }
  });
  $("#party").result(function(event, data, formatted) {
	  $("#partyId").val(data[1]);
	  $("#partyName").val(data[2]);
  });

  $("#incomingChallan").autocomplete("getInChallanAuto.php", 
	{    
		width: 150,     
		matchContains: true,
		mustMatch: false,
		minChars: 0,
		//multiple: true,
		highlight: false,
		//multipleSeparator: ",",
		selectFirst: true,
		formatItem: function(data, i, n, value) {   
		  return  value.split("|")[0];
	  }
  });
  $("#incomingChallan").result(function(event, data, formatted) {
	  $("#incomingIdAuto").val(data[1]);
	  $("#incChallan").val(data[2]);
  });

});
</script>
{/block}
{block name=body}
<form name="form1" id="form1" action="{$smarty.server.PHP_SELF}" method="post">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<tr>
		<td class="table1" align="center">Furnace : 
			<select name="fId" AUTOFOCUS>
				<option value="0">All</option>
				{html_options values=$furnaceArray.fId output=$furnaceArray.furnaceName selected=$selFId}
		  </select>
		</td>
		<td class="table1" align="center">
			Order By : 
			<select name="orderBy">
				{if $orderBy == 'DESC'}
				  <option value="DESC" SELECTED>Descending</option>
				  <option value="ASC">Ascending</option>
				{else}
				  <option value="DESC">Descending</option>
				  <option value="ASC" SELECTED>Ascending</option>
				{/if}
			</select>
		</td>
		<td class="table1" align="center">From : {html_select_date prefix="fromDate" time=$fromDate start_year ="-1" end_year="+2" field_order="DMY" month_format="%m" day_value_format="%02d"}</td>
		<td class="table1" align="center">To : {html_select_date prefix="toDate" time=$toDate start_year="-0" end_year="+2" field_order="DMY" month_format="%m" day_value_format="%02d"}</td>
		<td class="table1" align="center"><input type="submit" name="showData" class="link" value=" SHOW DATA " /></td>
	</tr>
</table>
</form>
{if $dataArray != 0}
<table border="1" cellpadding="0" cellspacing="0" width="100%">
<tr>
	<td class="table1" align="center" valign="top">Batch No.</td>
	<td class="table1" align="center" valign="top" >Date</td>
	<td class="table1" align="center" valign="top">Challan</td>
	<td class="table1" align="center" valign="top">Party</td>
	<td class="table1" align="center" valign="top">Material</td>
	<td class="table1" align="center" valign="top">Process</td>
	<td class="table1" align="center" valign="top">In</td>
	<td class="table1" align="center" valign="top">Out</td>
	<td class="table1" align="center" valign="top">Cycle</td>
	<td class="table1" align="center" valign="top">Check Qty</td>
	<td class="table1" align="center" valign="top">Hardness<br>Required</td>
	<td class="table1" align="center" valign="top">Status</td>
	<td class="table1" align="center" valign="top">Reason</td>
</tr>
{if $orderBy == 'DESC'}
{foreach from=$dataArray|@sortby:"-logsheetNo" item=entry key=entry_id}
  <tr>
  	<td class="table2" align="center" valign="top" NOWRAP>
  		<a href="logsheetEdit.php?logSheetId={$entry.logSheetId}&planningId={$entry.planningId}" title=" Edit Record " target="_blank" />
  		  {$entry.furnace}/{$entry.logsheetNo}
  	  </a>
  	</td>
  	<td class="table2" align="center" valign="top" style="font-size:10px;" nowrap>{$entry.logsheetDate}</td>
  	<td class="table2" align="center" valign="top">{$entry.challan}</td>
  	<td class="table2" align="center" valign="top" style="font-size:10px;" NOWRAP>{$entry.partyName}</td>
  	<td class="table2" align="center" valign="top" style="font-size:10px;">{$entry.materialName}</td>
  	<td class="table2" align="center" valign="top" style="font-size:10px;">{$entry.process}</td>
  	<td class="table2" align="center" valign="top">{$entry.startTime}</td>
  	<td class="table2" align="center" valign="top">{$entry.endTime}</td>
  	<td class="table2" align="center" valign="top" NOWRAP>{$entry.temp} x {$entry.soaking}</td>
  	<td class="table2" align="center" valign="top" style="font-size:10px;">{$entry.quantity}</td>
  	<td class="table2" align="center" valign="top">{$entry.hardne}</td>
  	<td class="table2" align="center" valign="top">{$entry.status}</td>
  	<td class="table2" align="center" valign="top">{$entry.notOkReason}</td>
  </tr>

{/foreach}
{else}
{foreach from=$dataArray|@sortby:"logsheetNo" item=entry key=entry_id}
  <tr>
  	<td class="table2" align="center" valign="top" NOWRAP>
  		<a href="logsheetEdit.php?logSheetId={$entry.logSheetId}&planningId={$entry.planningId}" title=" Edit Record " target="_blank" />
  		  {$entry.furnace}/{$entry.logsheetNo}
  	  </a>
  	</td>
  	<td class="table2" align="center" valign="top" NOWRAP>{$entry.furnace}/{$entry.logsheetNo}</td>
  	<td class="table2" align="center" valign="top" style="font-size:10px;" NOWRAP>{$entry.logsheetDate}</td>
  	<td class="table2" align="center" valign="top">{$entry.challan}</td>
  	<td class="table2" align="center" valign="top" style="font-size:10px;" NOWRAP>{$entry.partyName}</td>
  	<td class="table2" align="center" valign="top" style="font-size:10px;">{$entry.materialName}</td>
  	<td class="table2" align="center" valign="top" style="font-size:10px;">{$entry.process}</td>
  	<td class="table2" align="center" valign="top">{$entry.startTime}</td>
  	<td class="table2" align="center" valign="top">{$entry.endTime}</td>
  	<td class="table2" align="center" valign="top" NOWRAP>{$entry.temp} x {$entry.soaking}</td>
  	<td class="table2" align="center" valign="top" style="font-size:10px;">{$entry.quantity}</td>
  	<td class="table2" align="center" valign="top">{$entry.hardne}</td>
  	<td class="table2" align="center" valign="top">{$entry.status}</td>
  	<td class="table2" align="center" valign="top">{$entry.notOkReason}</td>
  </tr>

{/foreach}
{/if}
</table>
{/if}
{/block}